package com.permission.exception;

import com.permission.util.ResultVoUtil;
import com.permission.vo.ResultVo;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2018/4/13
 */
@ControllerAdvice
public class SysExceptionHandler {

    @ResponseBody
    @ExceptionHandler(value = SysException.class)
    public ResultVo handle(Exception e) {
        SysException sysException = (SysException) e;
        return ResultVoUtil.error(sysException.getCode(), sysException.getMessage());
    }

}
